<?php

class horsemanController extends manageController {

    public function __construct() {
        if (!isset($_SESSION['zp_manage']['islogin']) || empty($_SESSION['zp_manage']['islogin'])) {
            Tools::AlertTxt('?md=manage&cl=login&at=login', '请先登录');
            exit;
        }
    }


    public function horsemanlistAction() {
        $table = "horseman";
        $table = "xd_store";
        $func = (!empty($this->params['func'])) ? $this->params['func'] : '';
        $page = (!empty($this->params['page'])) ? (int) $this->params['page'] : 1;
        $_phone = (!empty($this->params['_phone'])) ? (int) $this->params['_phone'] : 1;
        $_name = (!empty($this->params['_name'])) ?  $this->params['_name'] : 1;
        $_horseman_status = (!empty($this->params['_horseman_status'])) ? (int) $this->params['_horseman_status'] : 1;
        $number_page = (!empty($this->params['number_page'])) ? $this->params['number_page'] : Data::$_number_page;
        $this->view->setVariable("_phone", $_phone);
        $this->view->setVariable("_name", $_name);
        $this->view->setVariable("_horseman_status", $_horseman_status);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setVariable("page", $page);


        // 骑手状态启停
        if (!empty($func) && $func == "status") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            if ($id > 0) {
                $where_fields = array("AND" => array("=" => array("id" => $id)));
                $row = $this->model->getItemById($id, $table);
                $field = array();
                $field['status'] = $row['status'] == '1' ? '0' : '1';
                $field['editor_id'] = $_SESSION['zp_manage']['uid'];
                $field['updatedt'] = 'now()';
                $r = $this->model->updateItem($field, $where_fields, $table);

                //日志
                $log = array();
                $log['table_id'] = $id;
                $log['table_name'] = $table;
                $log['type'] = 4;
                $log['page'] = "骑手状态启停";
                $log['content'] = $log['page'] . "：" . $this->params["id"];
                $org = array();
                $field1 = array();
                $this->model->setLog($log, $org, $field1);
            }
           echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        // 删除骑手
        if (!empty($func) && $func == "del") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            $field = array("isdeleted" => 1, 'editor_id' => $_SESSION['zp_manage']['uid'], 'updatedt' => 'now()');
            $where_fields = array("AND" => array("=" => array("id" => $id)));
            $this->model->updateItem($field, $where_fields, $table);

            //日志
            $log = array();
            $log['table_id'] = $id;
            $log['table_name'] = $table;
            $log['type'] = 3;
            $log['page'] = "删除骑手";
            $log['content'] = $log['page'] . "：" . $this->params["id"];
            $org = array();
            $field1 = array();
            $this->model->setLog($log, $org, $field1);
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        //抓列表
        $where_fields = array("AND" => array("=" => array("isdeleted" => 0)));

        $like_fields = array();
        if (!empty($query)) {
            $like_fields = array('store_id' => $query, 'storename' => $query);
        }
        $orderby = array('id' => 'asc');
        $total_count = $this->model->getTotalCount($table, $where_fields, $like_fields);
        $rsp_list = $this->model->getAllByPage($page, $number_page, $where_fields, $table, $like_fields, $orderby);
        $rsp_page_list = Tools::getPagesPost($_SERVER["QUERY_STRING"], $number_page, $page, $total_count);


        $this->view->setVariable("rsp_list", $rsp_list);
        $this->view->setVariable("rsp_page_list", $rsp_page_list);
        $this->view->setVariable("total_count", $total_count);
        $this->view->setVariable("page", $page);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }

    public function storelisteditAction(){
        $table = 'xd_store';
        $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
        $store_id = empty($this->params["store_id"]) ? '0' : (int) $this->params["store_id"];
        $phone = empty($this->params["phone"]) ? '0' : (int) $this->params["phone"];
        $pwd = empty($this->params["pwd"]) ? '0' : $this->params["pwd"];
        $page = (!empty($this->params['page'])) ? (int) $this->params['page'] : 1;
        $number_page = (!empty($this->params['number_page'])) ? $this->params['number_page'] : Data::$_number_page;

        if($store_id){
            if($pwd){
                $salt = Data::getSalt(20);
                $field['salt'] = $salt;
                $saltpwd = sha1($salt . $pwd);
                $field['password'] = $saltpwd;
            }
            $field['phone'] = $phone;
            $where_fields = array("AND" => array("=" => array("id" => $store_id)));
            $status = $this->model->updateItem($field, $where_fields, $table);
            if($status){
                $url = '?md=' . MvcReg::$_moduleName . '&cl=' . MvcReg::$_controllerName . '&at=storelist';
                $url .='&page='.$page;
                Tools::AlertTxt($url, $this->getKeyWord('SAVE') . $this->getKeyWord('Msg_Successful'));
            }else{
                $url = '?md=' . MvcReg::$_moduleName . '&cl=' . MvcReg::$_controllerName . '&at=storelist';
                $url .='&page='.$page;
                Tools::AlertTxt($url, $this->getKeyWord('SAVE') . $this->getKeyWord('Msg_Successful'));
            }
        }
        $this->view->setVariable("number_page", $number_page);
        $this->view->setVariable("page", $page);
        $row = $this->model->getItemById($id, 'xd_store');

        $this->view->setVariable("row", $row);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }


    public function horsemanList_checkAction(){
        $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
        $page = empty($this->params["page"]) ? '0' : (int) $this->params["page"];
        $exp_where['AND']['=']['id'] = $id;
        $OrderExpressData = $this->model->getItemByOther($exp_where,'orders_express');
        $where['AND']['=']['ph_no'] = $OrderExpressData[0]['ph_no'];
        $OrderDatas = $this->model->getItemByOther($where,'orders');
        $OrderData = $OrderDatas[0];
        $OrderData['express'] = $OrderExpressData;
        $where['and']['=']['ph_no'] = $OrderData['ph_no'];
//        $orderInfo = $this->model->getItemByOther($where,'orders_express');

        $orderProductInfo = $this->model->getItemByOther($where,'orders_product');
        $OrderData['product'] = $orderProductInfo;

        $epress = Data::$_express_type;
        $_order_status = Data::$_order_status;
        $this->view->setVariable("page", $page);
        $this->view->setVariable("order_status", $_order_status);
        $this->view->setVariable("express", $epress);
        $this->view->setVariable("rsp_list", $OrderData);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }

    public function getImageAction(){
        $oldImage = json_decode($_POST['oldImage'],true);
        $fileObj = $_FILES['file'];
        $tmpName = $_FILES['file']['name'];
        $picName = strrchr($tmpName,'.');
        $str = rand(1,99999);
        $useName = date('Ymd').$str;
        $newName = $useName.$picName;
        $upload_path = 'webroot/admin/temp_img/';
        if($oldImage){
            $oldImage_filter  = array_filter($oldImage);
            $oldImage_unique  = array_unique($oldImage_filter);
            foreach($oldImage_unique as $v){
                if($v){
                    unlink($v);
                }
            }
        }
        if(!file_exists($upload_path)) {
            mkdir($upload_path, 0700);
        }
        move_uploaded_file($fileObj['tmp_name'],$upload_path.$newName);
        $data = ['img'=>$upload_path.$newName,'status'=>1];
        echo json_encode($data);

    }
    public function unlinkImageAction(){
        $dir = 'webroot/admin/temp_img/';
        if (!$handle = @opendir($dir)) {
            return false;
        }
        while (false !== ($file = readdir($handle))) {
            if ($file !== "." && $file !== "..") {
                $file = $dir . '/' . $file;
                if (is_dir($file)) {
                    deleteDir($file);
                } else {
                    @unlink($file);
                }
            }
        }
        @rmdir($dir);
        $data = ['status'=>1];
        echo json_encode($data);
    }


    /**
     * 骑手待审核
     */
    public function horseman_audit_listAction() {
        $table = "xd_store";
        $func = (!empty($this->params['func'])) ? $this->params['func'] : '';
        $page = (!empty($this->params['page'])) ? (int) $this->params['page'] : 1;
        $_phone = (!empty($this->params['_phone'])) ? (int) $this->params['_phone'] : 1;
        $_name = (!empty($this->params['_name'])) ?  $this->params['_name'] : 1;
        $_horseman_status = (!empty($this->params['_horseman_status'])) ? (int) $this->params['_horseman_status'] : 1;
        $number_page = (!empty($this->params['number_page'])) ? $this->params['number_page'] : Data::$_number_page;
        $this->view->setVariable("_phone", $_phone);
        $this->view->setVariable("_name", $_name);
        $this->view->setVariable("_horseman_status", $_horseman_status);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setVariable("page", $page);


        // 骑手状态启停
        if (!empty($func) && $func == "status") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            if ($id > 0) {
                $where_fields = array("AND" => array("=" => array("id" => $id)));
                $row = $this->model->getItemById($id, $table);
                $field = array();
                $field['status'] = $row['status'] == '1' ? '0' : '1';
                $field['editor_id'] = $_SESSION['zp_manage']['uid'];
                $field['updatedt'] = 'now()';
                $r = $this->model->updateItem($field, $where_fields, $table);

                //日志
                $log = array();
                $log['table_id'] = $id;
                $log['table_name'] = $table;
                $log['type'] = 4;
                $log['page'] = "骑手状态启停";
                $log['content'] = $log['page'] . "：" . 1;
                $this->model->setLog($log, $row, $field);
            }
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        // 删除骑手
        if (!empty($func) && $func == "del") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            $field = array("isdeleted" => 1, 'editor_id' => $_SESSION['zp_manage']['uid'], 'updatedt' => 'now()');
            $where_fields = array("AND" => array("=" => array("id" => $id)));
            $this->model->updateItem($field, $where_fields, $table);

            //日志
            $log = array();
            $log['table_id'] = $id;
            $log['table_name'] = $table;
            $log['type'] = 3;
            $log['page'] = "删除骑手";
            $log['content'] = $log['page'] . "：" . $this->params["id"];
            $org = array();
            $this->model->setLog($log, $org, $field);
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        //抓列表
        $where_fields = array("AND" => array("=" => array("isdeleted" => 0)));

        $like_fields = array();
        if (!empty($query)) {
            $like_fields = array('store_id' => $query, 'storename' => $query);
        }
        $orderby = array('id' => 'asc');
        $total_count = $this->model->getTotalCount($table, $where_fields, $like_fields);
        $rsp_list = $this->model->getAllByPage($page, $number_page, $where_fields, $table, $like_fields, $orderby);
        $rsp_page_list = Tools::getPagesPost($_SERVER["QUERY_STRING"], $number_page, $page, $total_count);


        $this->view->setVariable("rsp_list", $rsp_list);
        $this->view->setVariable("rsp_page_list", $rsp_page_list);
        $this->view->setVariable("total_count", $total_count);
        $this->view->setVariable("page", $page);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }


    public function horseman_audit_list_checkAction(){
        $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
        $page = empty($this->params["page"]) ? '0' : (int) $this->params["page"];
        $exp_where['AND']['=']['id'] = $id;
        $OrderExpressData = $this->model->getItemByOther($exp_where,'orders_express');
        $where['AND']['=']['ph_no'] = $OrderExpressData[0]['ph_no'];
        $OrderDatas = $this->model->getItemByOther($where,'orders');
        $OrderData = $OrderDatas[0];
        $OrderData['express'] = $OrderExpressData;
        $where['and']['=']['ph_no'] = $OrderData['ph_no'];
//        $orderInfo = $this->model->getItemByOther($where,'orders_express');

        $orderProductInfo = $this->model->getItemByOther($where,'orders_product');
        $OrderData['product'] = $orderProductInfo;

        $epress = Data::$_express_type;
        $_order_status = Data::$_order_status;
        $this->view->setVariable("page", $page);
        $this->view->setVariable("order_status", $_order_status);
        $this->view->setVariable("express", $epress);
        $this->view->setVariable("rsp_list", $OrderData);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }

    /**
     * 骑手审核未通过
     */
    public function horseman_no_pass_listAction() {
        $table = "horseman";
        $table = "xd_store";
        $func = (!empty($this->params['func'])) ? $this->params['func'] : '';
        $page = (!empty($this->params['page'])) ? (int) $this->params['page'] : 1;
        $_phone = (!empty($this->params['_phone'])) ? (int) $this->params['_phone'] : 1;
        $_name = (!empty($this->params['_name'])) ?  $this->params['_name'] : 1;
        $_horseman_status = (!empty($this->params['_horseman_status'])) ? (int) $this->params['_horseman_status'] : 1;
        $number_page = (!empty($this->params['number_page'])) ? $this->params['number_page'] : Data::$_number_page;
        $this->view->setVariable("_phone", $_phone);
        $this->view->setVariable("_name", $_name);
        $this->view->setVariable("_horseman_status", $_horseman_status);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setVariable("page", $page);


        // 骑手状态启停
        if (!empty($func) && $func == "status") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            if ($id > 0) {
                $where_fields = array("AND" => array("=" => array("id" => $id)));
                $row = $this->model->getItemById($id, $table);
                $field = array();
                $field['status'] = $row['status'] == '1' ? '0' : '1';
                $field['editor_id'] = $_SESSION['zp_manage']['uid'];
                $field['updatedt'] = 'now()';
                $r = $this->model->updateItem($field, $where_fields, $table);

                //日志
                $log = array();
                $log['table_id'] = $id;
                $log['table_name'] = $table;
                $log['type'] = 4;
                $log['page'] = "骑手状态启停";
                $log['content'] = $log['page'] . "：" . $this->params["id"];
                $this->model->setLog($log, $row, $field);
            }
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        // 删除骑手
        if (!empty($func) && $func == "del") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            $field = array("isdeleted" => 1, 'editor_id' => $_SESSION['zp_manage']['uid'], 'updatedt' => 'now()');
            $where_fields = array("AND" => array("=" => array("id" => $id)));
            $this->model->updateItem($field, $where_fields, $table);

            //日志
            $log = array();
            $log['table_id'] = $id;
            $log['table_name'] = $table;
            $log['type'] = 3;
            $log['page'] = "删除骑手";
            $log['content'] = $log['page'] . "：" . 1;
            $org = array();
            $field1 = array();
            $this->model->setLog($log, $org, $field1);
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        //抓列表
        $where_fields = array("AND" => array("=" => array("isdeleted" => 0)));

        $like_fields = array();
        if (!empty($query)) {
            $like_fields = array('store_id' => $query, 'storename' => $query);
        }
        $orderby = array('id' => 'asc');
        $total_count = $this->model->getTotalCount($table, $where_fields, $like_fields);
        $rsp_list = $this->model->getAllByPage($page, $number_page, $where_fields, $table, $like_fields, $orderby);
        $rsp_page_list = Tools::getPagesPost($_SERVER["QUERY_STRING"], $number_page, $page, $total_count);


        $this->view->setVariable("rsp_list", $rsp_list);
        $this->view->setVariable("rsp_page_list", $rsp_page_list);
        $this->view->setVariable("total_count", $total_count);
        $this->view->setVariable("page", $page);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }

    public function horseman_no_pass_list_checkAction(){
        $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
        $page = empty($this->params["page"]) ? '0' : (int) $this->params["page"];
        $exp_where['AND']['=']['id'] = $id;
        $OrderExpressData = $this->model->getItemByOther($exp_where,'orders_express');
        $where['AND']['=']['ph_no'] = $OrderExpressData[0]['ph_no'];
        $OrderDatas = $this->model->getItemByOther($where,'orders');
        $OrderData = $OrderDatas[0];
        $OrderData['express'] = $OrderExpressData;
        $where['and']['=']['ph_no'] = $OrderData['ph_no'];
//        $orderInfo = $this->model->getItemByOther($where,'orders_express');

        $orderProductInfo = $this->model->getItemByOther($where,'orders_product');
        $OrderData['product'] = $orderProductInfo;

        $epress = Data::$_express_type;
        $_order_status = Data::$_order_status;
        $this->view->setVariable("page", $page);
        $this->view->setVariable("order_status", $_order_status);
        $this->view->setVariable("express", $epress);
        $this->view->setVariable("rsp_list", $OrderData);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }



    /**
     * 骑手审核未通过
     */
    public function horseman_freight_listAction() {
        $table = "xd_store";
        $func = (!empty($this->params['func'])) ? $this->params['func'] : '';
        $page = (!empty($this->params['page'])) ? (int) $this->params['page'] : 1;
        $_phone = (!empty($this->params['_phone'])) ? (int) $this->params['_phone'] : 1;
        $_name = (!empty($this->params['_name'])) ?  $this->params['_name'] : 1;
        $_horseman_status = (!empty($this->params['_horseman_status'])) ? (int) $this->params['_horseman_status'] : 1;
        $number_page = (!empty($this->params['number_page'])) ? $this->params['number_page'] : Data::$_number_page;
        $this->view->setVariable("_phone", $_phone);
        $this->view->setVariable("_name", $_name);
        $this->view->setVariable("_horseman_status", $_horseman_status);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setVariable("page", $page);


        // 骑手状态启停
        if (!empty($func) && $func == "status") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            if ($id > 0) {
                $where_fields = array("AND" => array("=" => array("id" => $id)));
                $row = $this->model->getItemById($id, $table);
                $field = array();
                $field['status'] = $row['status'] == '1' ? '0' : '1';
                $field['editor_id'] = $_SESSION['zp_manage']['uid'];
                $field['updatedt'] = 'now()';
                $r = $this->model->updateItem($field, $where_fields, $table);

                //日志
                $log = array();
                $log['table_id'] = $id;
                $log['table_name'] = $table;
                $log['type'] = 4;
                $log['page'] = "骑手状态";
                $log['content'] = $log['page'] . "：" . $this->params["id"];
                $this->model->setLog($log, $row, $field);
            }
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        // 删除骑手
        if (!empty($func) && $func == "del") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            $field = array("isdeleted" => 1, 'editor_id' => $_SESSION['zp_manage']['uid'], 'updatedt' => 'now()');
            $row = $this->model->getItemById($id, $table);
            $where_fields = array("AND" => array("=" => array("id" => $id)));
            $this->model->updateItem($field, $where_fields, $table);

            //日志
            $log = array();
            $log['table_id'] = $id;
            $log['table_name'] = $table;
            $log['type'] = 3;
            $log['page'] = "删除骑手";
            $log['content'] = $log['page'] . "：" . $this->params["id"];
            $this->model->setLog($log, $row, $field);
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        //抓列表
        $where_fields = array("AND" => array("=" => array("isdeleted" => 0)));

        $like_fields = array();
        if (!empty($query)) {
            $like_fields = array('store_id' => $query, 'storename' => $query);
        }
        $orderby = array('id' => 'asc');
        $total_count = $this->model->getTotalCount($table, $where_fields, $like_fields);
        $rsp_list = $this->model->getAllByPage($page, $number_page, $where_fields, $table, $like_fields, $orderby);
        $rsp_page_list = Tools::getPagesPost($_SERVER["QUERY_STRING"], $number_page, $page, $total_count);


        $this->view->setVariable("rsp_list", $rsp_list);
        $this->view->setVariable("rsp_page_list", $rsp_page_list);
        $this->view->setVariable("total_count", $total_count);
        $this->view->setVariable("page", $page);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }

    /**
     * 骑手审核未通过
     */
    public function horseman_freight_list_checkAction() {
        $table = "horseman";
        $table = "xd_store";
        $func = (!empty($this->params['func'])) ? $this->params['func'] : '';
        $page = (!empty($this->params['page'])) ? (int) $this->params['page'] : 1;
        $_phone = (!empty($this->params['_phone'])) ? (int) $this->params['_phone'] : 1;
        $_name = (!empty($this->params['_name'])) ?  $this->params['_name'] : 1;
        $_horseman_status = (!empty($this->params['_horseman_status'])) ? (int) $this->params['_horseman_status'] : 1;
        $number_page = (!empty($this->params['number_page'])) ? $this->params['number_page'] : Data::$_number_page;
        $this->view->setVariable("_phone", $_phone);
        $this->view->setVariable("_name", $_name);
        $this->view->setVariable("_horseman_status", $_horseman_status);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setVariable("page", $page);


        // 骑手状态启停
        if (!empty($func) && $func == "status") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            if ($id > 0) {
                $where_fields = array("AND" => array("=" => array("id" => $id)));
                $row = $this->model->getItemById($id, $table);
                $field = array();
                $field['status'] = $row['status'] == '1' ? '0' : '1';
                $field['editor_id'] = $_SESSION['zp_manage']['uid'];
                $field['updatedt'] = 'now()';
                $r = $this->model->updateItem($field, $where_fields, $table);

                //日志
                $log = array();
                $log['table_id'] = $id;
                $log['table_name'] = $table;
                $log['type'] = 4;
                $log['page'] = "骑手状态";
                $log['content'] = $log['page'] . "：" . $this->params["id"];
                $this->model->setLog($log, $row, $field);
            }
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        // 删除骑手
        if (!empty($func) && $func == "del") {
            $id = empty($this->params["id"]) ? '0' : (int) $this->params["id"];
            $field = array("isdeleted" => 1, 'editor_id' => $_SESSION['zp_manage']['uid'], 'updatedt' => 'now()');
            $row = $this->model->getItemById($id, $table);
            $where_fields = array("AND" => array("=" => array("id" => $id)));
            $this->model->updateItem($field, $where_fields, $table);

            //日志
            $log = array();
            $log['table_id'] = $id;
            $log['table_name'] = $table;
            $log['type'] = 3;
            $log['page'] = "删除骑手";
            $log['content'] = $log['page'] . "：" . 1;
            $this->model->setLog($log, $row, $field);
            echo json_encode(array('status'=>1),JSON_UNESCAPED_UNICODE);
            exit;
        }

        //抓列表
        $where_fields = array("AND" => array("=" => array("isdeleted" => 0)));

        $like_fields = array();
        if (!empty($query)) {
            $like_fields = array('store_id' => $query, 'storename' => $query);
        }
        $orderby = array('id' => 'asc');
        $total_count = $this->model->getTotalCount($table, $where_fields, $like_fields);
        $rsp_list = $this->model->getAllByPage($page, $number_page, $where_fields, $table, $like_fields, $orderby);
        $rsp_page_list = Tools::getPagesPost($_SERVER["QUERY_STRING"], $number_page, $page, $total_count);


        $this->view->setVariable("rsp_list", $rsp_list);
        $this->view->setVariable("rsp_page_list", $rsp_page_list);
        $this->view->setVariable("total_count", $total_count);
        $this->view->setVariable("page", $page);
        $this->view->setVariable("number_page", $number_page);
        $this->view->setViewfilepath(MvcReg::$_moduleName . '/views/' . MvcReg::$_actionName . 'View.php');
        $this->view->render();
    }
}

?>
